public class ProgressBar{

  PVector locationOfOutlineBar, locationOfBar;
  float maxProgress, currentProgress;
  PImage imageOfBar, outlineOfBar;
  
 public ProgressBar(PImage imageOfBar, PImage outlineOfBar, PVector locationOfOutlineBar, PVector locationOfBar, int maxProgress){
  this.maxProgress = maxProgress;
  this.imageOfBar = imageOfBar;
  this.outlineOfBar = outlineOfBar;
  this.locationOfBar = locationOfBar;
  this.locationOfOutlineBar = locationOfOutlineBar;
 } 
 
 public void setProgress(int progress){
   if((progress >= 0) && (progress <= maxProgress)){
     currentProgress = progress; 
   }
 }
 
 public void updateBar(){
   image(outlineOfBar, locationOfOutlineBar.x, locationOfOutlineBar.y);
   pushMatrix();
   translate(locationOfBar.x, locationOfBar.y);
   scale(currentProgress/maxProgress, 1.0);
   image(imageOfBar, 0, 0);  
   popMatrix();
 }
 
}
